package com.first.agent.service.impl;

import com.first.agent.dao.CloudDao;
import com.first.agent.dao.impl.CloudDaoImpl;
import com.first.agent.pojo.Cloud;
import com.first.agent.pojo.gateway;
import com.first.agent.service.CloudService;
import com.sun.org.apache.bcel.internal.generic.ARETURN;

import java.sql.SQLException;
import java.util.List;

/**
 * @author 创建人名称
 * @version 1.0.0
 * @ClassName CloudServiceImpl.java
 * @Description TODO
 * @createTime 2022年11月15日 11:08
 */
public class CloudServiceImpl implements CloudService {
    private CloudDao cloudDao=new CloudDaoImpl();
    /*
    门户管理默认页面的数据显示和条件查询
     */
    public List<gateway> selectgate(String kw_name,String customer_name,Integer page,Integer limit){
        try {
            List<gateway> s1 = cloudDao.selectGate(kw_name, customer_name,page,limit);

            return s1;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
    /*
    移动云端信息查询
     */
    public List<Cloud> selectCloud(){
        try {
            List<Cloud> s1 = cloudDao.selectCloud();
            return s1;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
    /*
    移动云端信息修改
     */
    public int changeCloud(Cloud cloud){
        try {
            int i = cloudDao.changeCloud(cloud);
            return i;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return 0;
    }

    /**
     * 计数
     * @return
     */
    public int count(){
        try {
            int i = cloudDao.count();
            return i;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return 0;
    }
    public int counta(String kw_name,String customer_name){
        try {
            int i = cloudDao.counta(kw_name, customer_name);
            return i;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return 0;
    }
    /**
     * 添加云端
     */
    public int addCloud(Cloud cloud){
        try {
            int i = cloudDao.addCloud(cloud);
            return i;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return 0;
    }
    /**
     *删除移动云端
     */
    public int del(Integer id){
        try {
            int i = cloudDao.del(id);
            return i;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return 0;
    }

}
